#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
class Solution {
public:
	int sumOddLengthSubarrays(vector<int>& arr) {
		int res = 0;
		vector<int> sum;
		sum.push_back(arr[0]);
		for (int i = 1; i < arr.size(); i++) {
			sum.push_back(arr[i] + sum[i - 1]);
		}
		for (int i = 1; i <= arr.size(); i += 2) {
			for (int j = 0; j < arr.size() - i+1; j++) {
				res += -sum[j] + sum[j + i - 1] + arr[j];
			}
		}
		return res;
	}

};
int main() {
	Solution s;
	vector<int> a = { 10,11,12,12};
	cout<<s.sumOddLengthSubarrays(a);

}